
import traceback
from app import celery_app
from app.db.models.asset_tasks import AssetTasks
from app.libs.utils import enable_task_group


@celery_app.task(acks_late=True, name="scanv:batch_update_task_config")
def batch_update_task_config(job_ids):
    for at in AssetTasks.objects.filter(
            jobId__in=job_ids, taskGroupType="web_security", enableMonitor=True, triggerType="schedule"):
        try:
            enable_task_group(at)
        except:
            traceback.print_exc()
